<?php
namespace app\api\controller\v1;
use app\api\controller\Base;
use app\api\model\Category as CategoryModel;
use app\lib\exception\MissEx;
/** 
* Document
*/
class Category extends Base {
    
    public function getAll(){
        $categorys = CategoryModel::all();

        if(empty($categorys)) throw new MissEx('请求的分类不存在',30004);
        
        foreach ($categorys as $v) {
            $one = $v->toArray();
            $one['topic_img'] = $v->topic_img;
            $resDate[] = $one;
        }
        
        return $this->data($resDate);
    }
}